#pragma once
#ifndef __HELPER_H__
#define __HELPER_H__

#include <Windows.h>

// Calculates the number of elements in an array.
#define SIZEOF_ARRAY(x) ((sizeof(x))/(sizeof(*x)))

// Console colours.
#define CONSOLE_RED FOREGROUND_RED | FOREGROUND_INTENSITY
#define CONSOLE_DARK_RED FOREGROUND_RED
#define CONSOLE_GREEN FOREGROUND_GREEN | FOREGROUND_INTENSITY
#define CONSOLE_DARK_GREEN FOREGROUND_GREEN
#define CONSOLE_BLUE FOREGROUND_BLUE | FOREGROUND_INTENSITY
#define CONSOLE_DARK_BLUE FOREGROUND_BLUE
#define CONSOLE_CYAN FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY
#define CONSOLE_YELLOW FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY
#define CONSOLE_DARK_YELLOW FOREGROUND_GREEN | FOREGROUND_RED
#define CONSOLE_PURPLE FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY
#define CONSOLE_DARK_PURPLE FOREGROUND_BLUE | FOREGROUND_RED
#define CONSOLE_WHITE FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY
#define CONSOLE_GRAY FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED

#define PRINT_INFO(fmt, ...) PrintDebug(DEBUG_INFO, fmt, __VA_ARGS__)
#define PRINT_SUCCESS(fmt, ... ) PrintDebug(DEBUG_SUCCESS, fmt, __VA_ARGS__)
#define PRINT_WARNING(fmt, ...) PrintDebug(DEBUG_WARNING, fmt, __VA_ARGS__)
#define PRINT_ERROR(fmt, ...) PrintDebug(DEBUG_ERROR, fmt, __VA_ARGS__)

typedef enum _DEBUG_LEVEL {
	DEBUG_INFO,
	DEBUG_SUCCESS,
	DEBUG_WARNING,
	DEBUG_ERROR
} DEBUG_LEVEL;

extern CHAR dbgSym[];
extern WORD dbgColour[];

void PrintColour(const WORD wColour, const LPSTR fmt, ...);
void PrintDebug(const DEBUG_LEVEL l, const LPSTR fmt, ...);
BOOL PromptYesNo(void);
LPVOID MyHeapAlloc(SIZE_T nSize);
BOOL MyHeapFree(LPVOID lpMem);

#endif // !__HELPER_H__
